package br.unifor.mia.sd.proxy;

import java.util.logging.Level;
import java.util.logging.Logger;

public class DefaultDispatcherFactory implements DispatcherFactory {
 
	Logger logger = Logger.getLogger("br.unifor.mia.sd.proxy");
	
	/**
	 * @see br.unifor.mia.sd.proxy.DispatcherFactory#createDispatcher()
	 */
	public Dispatcher createDispatcher(HttpMessage message) {
		Dispatcher disp = null;
		
		if(message.isWsCall()) {
			disp = new WSDispatcher();
			if(logger.isLoggable(Level.FINE)) {
				logger.log(Level.FINE, "Web Services call. Creating WSDispatcher.");
			}
			
		} else {
			disp = new HttpDispatcher();
			
			if(logger.isLoggable(Level.FINE)) {
				logger.log(Level.FINE, "Simples Http packet. Creating HttpDispatcher.");
			}
		}
		return disp;
	}
	 
}
 
